{template '_header'}
<div class="page-heading">
	<span class='pull-right'>
		{ifp 'cashier.user.add'}
			<a class="btn btn-primary btn-sm" href="{php echo webUrl('cashier/user/add')}">添加新收银台</a>
		{/if}
		<a class="btn btn-default  btn-sm" href="{php echo webUrl('cashier/user')}">返回列表</a>
	</span>
    <h2>{if !empty($item['id'])}编辑{else}添加{/if}收银台 <small>{if !empty($item['id'])}修改【{$item['title']}】{/if}</small></h2>
</div>

<form id="setform"  {ifp 'cashier.set.edit'}action="" method="post"{/if} class="form-horizontal form-validate">
<input type="hidden" id="tab" name="tab" value="#tab_basic" />
<div class="tabs-container">
    <ul class="nav nav-tabs" id="myTab">
        <li  {if empty($_GPC['tab']) || $_GPC['tab']=='basic'}class="active"{/if}><a href="#tab_basic">基本设置</a></li>
        <li  {if $_GPC['tab']=='printer'}class="active"{/if}><a href="#tab_printer">打印设置</a></li>
        <li  {if $_GPC['tab']=='pay'}class="active"{/if}><a href="#tab_pay">支付设置</a></li>
        <li  {if $_GPC['tab']=='sale'}class="active"{/if}><a href="#tab_sale">营销设置</a></li>
        <li  {if $_GPC['tab']=='withdraw'}class="active"{/if}><a href="#tab_withdraw">结算设置</a></li>
        <li  {if $_GPC['tab']=='account'}class="active"{/if}><a href="#tab_account">账户设置</a></li>
    </ul>
    <div class="tab-content ">
        <div class="tab-pane {if empty($_GPC['tab']) || $_GPC['tab']=='basic'}active{/if}" id="tab_basic">{template 'cashier/user/post/basic'}</div>
        <div class="tab-pane {if $_GPC['tab']=='printer'}active{/if}" id="tab_printer">{template 'cashier/user/post/printer'}</div>
        <div class="tab-pane {if $_GPC['tab']=='pay'}active{/if}" id="tab_pay">{template 'cashier/user/post/pay'}</div>
        <div class="tab-pane {if $_GPC['tab']=='sale'}active{/if}" id="tab_sale">{template 'cashier/user/post/sale'}</div>
        <div class="tab-pane {if $_GPC['tab']=='withdraw'}active{/if}" id="tab_withdraw">{template 'cashier/user/post/withdraw'}</div>
        <div class="tab-pane {if $_GPC['tab']=='account'}active{/if}" id="tab_account">{template 'cashier/user/post/account'}</div>
    </div>
</div>
{ifp 'cashier.set.edit'}
<div class="form-group">
    <label class="col-sm-2 control-label"></label>
    <div class="col-sm-9 col-xs-12">
        <input type="submit"  value="提交" class="btn btn-primary" />
    </div>
</div>
{/if}
</form>

<script language='javascript'>
    require(['bootstrap'], function () {
        $('#myTab a').click(function (e) {
            $('#tab').val($(this).attr('href'));
            e.preventDefault();
            $(this).tab('show');
        })
    });

    $(function () {
        $(":radio[name=wechat_status],:radio[name=alipay_status]").on("click",function (e) {
            var $this = $(this);
            var $status;
            if ($this.attr('name') == 'wechat_status'){
                $status = $(":radio[name=alipay_status]:checked");
            }else{
                $status = $(":radio[name=wechat_status]:checked");
            }
            var $next = $this.parents(".form-group").next();
            $this.val()=='1' ?  $next.show() : $next.hide();
        });
    });
</script>
{template '_footer'}